#include <MAUtil/Moblet.h>
#include <MAUI/Font.h>
#include <MAUI/WidgetSkin.h>
#include "std.h"
#include "AppLoader.h"
#include "MAHeaders.h"
#include <MAUI/Engine.h>
#include <MAUtil/Environment.h>

using namespace MAUtil;
using namespace MAUI;
class StarterMoblet :  public Moblet
{
	public:
	StarterMoblet()
		{
			//Create a new font, and give it to the AppController to look after it.
		    APPCONTROLLER->addFont("default", new Font(RES_FONT));
		    //APPCONTROLLER->addFont("title", new Font(TITLE_FONT));
		    //APPCONTROLLER->addFont("itemfont", new Font(ITEM_FONT));
    		//The font can be retrieved from the AppController by name
    		Engine::getSingleton().setDefaultFont(APPCONTROLLER->getFont("default"));

    		//Create a new skin, and give it to the AppController to look after it
    		APPCONTROLLER->addSkin("title", new WidgetSkin(TITLE_SKIN, TITLE_SKIN, 11, 27, 22, 74, false, false));
    		//APPCONTROLLER->addSkin("rssitem", new WidgetSkin(RSS_SKIN, RSS_SKIN, 2, 62, 2, 62, false, false));
    		APPCONTROLLER->addSkin("default", new WidgetSkin(RES_SELECTED, RES_UNSELECTED, 16, 32, 16, 32, true, true));
    		//The AppController needs a pointer to the moblet
			APPCONTROLLER->setMoblet(this);

			//Load the screens - no knowledge of screens required at buildtime
			AppLoader* loader = new AppLoader();
			loader->load();
			delete loader;

			//Show the first screen.  This was loaded in AppLoader
			APPCONTROLLER->show("FlashScreen");
		}

		~StarterMoblet()
		{
			delete APPCONTROLLER;
		}
	private:
};

extern "C" int MAMain()
{
	Moblet::run(new StarterMoblet());
	return 0;
};
